package edu.sdjzu.exam.dto;

import lombok.Data;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.Valid;
import java.math.BigDecimal;
import java.util.List;

@Data
public class GradingDTO {
    @NotNull(message = "答案ID不能为空")
    private Long answerId;
    
    @NotNull(message = "分数不能为空")
    @DecimalMin(value = "0.0", message = "分数不能小于0")
    private BigDecimal score;
    
    @Size(max = 1000, message = "评语长度不能超过1000字符")
    private String comment;
    
    @Data
    public static class BatchGradingDTO {
        @NotNull(message = "考试ID不能为空")
        private Long examId;
        
        @NotNull(message = "学生ID不能为空")
        private Long studentId;
        
        @NotNull(message = "批改列表不能为空")
        @NotEmpty(message = "批改列表不能为空")
        @Valid
        private List<GradingDTO> gradings;
    }
    
    @Data
    public static class ExamGradingListDTO {
        private Long examId;
        private String examTitle;
        private int totalStudents;
        private int pendingStudents;
        private int completedStudents;
    }
    
    @Data
    public static class StudentGradingListDTO {
        private Long studentId;
        private String studentName;
        private String gradeStatus;
        private int totalSubjectiveQuestions;
        private int gradedQuestions;
        private BigDecimal currentScore;
        private String submitTime;
    }
    
    @Data
    public static class SubjectiveAnswerDTO {
        private Long answerId;
        private Long questionId;
        private String questionContent;
        private String questionType;
        private String referenceAnswer;
        private BigDecimal points;
        private BigDecimal maxScore;
        private String answerContent;
        private String filePath;
        private BigDecimal score;
        private String comment;
        private Long markedBy;
        private String markedByName;
    }
}